
import java.io.*;
import java.net.*;
import java.util.*;

import javax.swing.Icon;
import javax.swing.ImageIcon;


class LycosSearchWorker extends SearchWorker
{
    private final static String template = 
	    "<LI>"
	+    " <FONT @(any)>" 
        +      " <a @(any)target=@(any=url)&query=@(any)\">"
        +      " @(any=title)"
        +       "</a>"
        +      " @(any=text)"
        +     "</FONT>@(any)"
        +   "</LI>";


    private final static PageParser parser = new PageParser(template);

    private final static Icon icon = new ImageIcon("images/lycos.gif");

    public LycosSearchWorker(Search search, String query) {
	super(search, query);
    }

    protected PageParser getPageParser() {
	return parser;
    }

    /**
     * Lycos hits are numbered from 1 rather than 0
     */
    protected URL getPageURL(String q, int t) throws MalformedURLException {
	String queryURLString = 
	    "http://www.lycos.com/srch/more.html?type=websites&query=" + q + "&first=" + (t + 1);
	return new URL(queryURLString);
    }

    public String getSiteName() {
	return "Lycos";
    }

    public Icon getSiteIcon() {
	return icon;
    }
}
